package com.niiwoo.civet.user.service.duboo;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.user.dao.entity.UserExtInfo;
import com.niiwoo.civet.user.dao.mapper.UserExtInfoMapperExt;
import com.niiwoo.civet.user.dto.response.UserExtInfoResponseDTO;
import com.niiwoo.civet.user.service.UserExtInfoDubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 用户扩展信息服务
 */
@Service(version = "1.0.0")
public class UserExtInfoDubboServiceImpl implements UserExtInfoDubboService {
    @Autowired
    private UserExtInfoMapperExt userExtInfoMapper;

    /**
     * 查询用户扩展信息
     * @param userId
     * @return
     */
    @Override
    public UserExtInfoResponseDTO queryUserBasicInfo(String userId) {
        UserExtInfo userExtInfo = userExtInfoMapper.selectByPrimaryKey(userId);
        if (userExtInfo == null) {
            return null;
        }

        UserExtInfoResponseDTO userExtInfoResponseDTO = new UserExtInfoResponseDTO();
        userExtInfoResponseDTO.setUserId(userExtInfo.getUserId());
        userExtInfoResponseDTO.setAppDownloadChannel(userExtInfo.getAppDownloadChannel());
        userExtInfoResponseDTO.setRegisterProvince(userExtInfo.getRegisterProvince());
        userExtInfoResponseDTO.setRegisterCity(userExtInfo.getRegisterCity());
        userExtInfoResponseDTO.setRegisterArea(userExtInfo.getRegisterArea());
        userExtInfoResponseDTO.setRegisterAddress(userExtInfo.getRegisterAddress());
        userExtInfoResponseDTO.setRegisterLongitude(userExtInfo.getRegisterLongitude());
        userExtInfoResponseDTO.setRegisterLatitude(userExtInfo.getRegisterLatitude());
        userExtInfoResponseDTO.setDeviceType(userExtInfo.getDeviceType());
        userExtInfoResponseDTO.setAppVersion(userExtInfo.getAppVersion());
        userExtInfoResponseDTO.setLastLoginProvince(userExtInfo.getLastLoginProvince());
        userExtInfoResponseDTO.setLastLoginCity(userExtInfo.getLastLoginCity());
        userExtInfoResponseDTO.setLastLoginArea(userExtInfo.getLastLoginArea());
        userExtInfoResponseDTO.setLastLoginAddress(userExtInfo.getLastLoginAddress());
        userExtInfoResponseDTO.setLastLoginLongitude(userExtInfo.getLastLoginLongitude());
        userExtInfoResponseDTO.setLastLoginLatitude(userExtInfo.getLastLoginLatitude());
        userExtInfoResponseDTO.setLastLoginIp(userExtInfo.getLastLoginIp());
        userExtInfoResponseDTO.setLastLoginDevice(userExtInfo.getLastLoginDevice());
        userExtInfoResponseDTO.setCreateTime(userExtInfo.getCreateTime());
        userExtInfoResponseDTO.setUpdateTime(userExtInfo.getUpdateTime());
        userExtInfoResponseDTO.setJiuangPushId(userExtInfo.getJiGuangPushId());
        userExtInfoResponseDTO.setBlackBox(userExtInfo.getBlackBox());

        return userExtInfoResponseDTO;
    }
}
